<layout name="layout" />
<link href="__PUBLIC__/Home/css/bootstrap.css" rel="stylesheet" />
<div class="panel panel-success">
    <div class="panel-heading">
        <h3 class="panel-title">会员入场</h3>
    </div>
    <div class="panel-body">
        <form role="form "  class="form-horizontal">
            <div class="checkbox ">
                <label >
                    <input type="checkbox" name="coming" > 启用直接刷卡入场/出场
                </label>
            </div>
            <div class="form-input col-xs-2">
                <label for="kahao" >卡号</label>
                <input type="text" class="form-control col-xs-2 " id="kahao" name="kahao" placeholder="请输入卡号" required>
            </div>
             <div class="form-input col-xs-2">
                <label for="hand_card">手牌</label>
                <input type="text" class="form-control col-xs-2 " id="hand_card" name="hand_card" placeholder="请输入手牌" required>
            </div>
            <div class="form-input col-xs-2">
                <label for="username">姓名</label>
                <input type="text" class="form-control col-xs-2 " id="username" name="username" placeholder="" disabled>
            </div>
           <div class="form-input col-xs-2">
                <label for="kaxiang">卡种</label>
                <input type="text" class="form-control col-xs-2 " id="kaxiang" name="kaxiang" placeholder="" disabled>
            </div>
            <div class="form-input col-xs-2">
                <label for="status">状态</label>
                <input type="text" class="form-control col-xs-2 " id="status" name="status" placeholder="" disabled>
            </div>
            <div class="form-input col-xs-2">
                <label for="time">有效期</label>
                <input type="text" class="form-control col-xs-2 " id="time" name="time" placeholder="" disabled>
            </div>
            <div class="form-input col-xs-2">
            <button type="button" class="btn btn-primary member_come" disabled>健身入场</button>
            <button type="button" class="btn btn-warning" disabled>私教入场</button>
            </div>
        </form>

    </div>
</div>
<div class="panel panel-info">
    <div class="panel-heading">照片</div>
    <div class="panel-body">
        <div class="form-input">
            <input type="file" required/>
        </div>
    </div>
</div>
<div class="panel panel-info">
    <div class="panel-heading">
        <h3 class="panel-title">会员入场情况</h3>
    </div>
    <div class="panel-body">
        <table class="table table-hover">
            <thead>
            <tr>
                <th>姓名</th>
                <th>卡号</th>
                <th>手牌</th>
                <th>入场日期</th>
                <th>入场时间</th>
            </tr>
            </thead>
            <tbody>
            <tr id="come">

            </tr>
            </tbody>
        </table>
    </div>
</div>
<script type="text/javascript" src="__PUBLIC__/Admin/js/layer.js"></script>
<script>
    $(document).ready(function () {
        $("#kahao").change(function () {
            var data = {
                'code' :$("#kahao").val()
            }
            $.post(
                "{:U('Yuyue/checkCode')}",
                data,
                function (res) {
                    if(res['status'] == 'success'){
                        layer.msg(res['msg'],{icon:6});
                        $(".member_come").attr('disabled',false);
                        $("#username").val(res['data'][0].username);
                        $("#kaxiang").val(res['data'][0].kaxiang);
                        if(res['data'][0].status ==0 ){
                            $("#status").val('禁用');
                        }else{
                            $("#status").val('启用');
                        }
                        $("#time").val(res['data'][0].start_time + '至' + res['data'][0].end_time);

                    }else{
                        layer.msg(res['msg'],{icon:5});
                        $(".member_come").attr('disabled',true);

                    }
                },"json"
            );
        });
        $(".member_come").click(function () {
            var data =$("form").serialize();
//            console.log(data);return;
            $.post(
                "{:U('Yuyue/admission')}",
                data,
                function (res) {
                    if(res['status' == 'success']){
                        layer.msg(res['msg']);
                    }else{
                        layer.msg(res['msg']);
                    }
                },
                "json");
        });
    });

</script>

